<template>
  <div>
    <h1>{{$t('vr.personalinfor')}}</h1>
    <ul class="infoUl">
      <li>
        <i>{{$t('vr.surname')}}</i>
        <span>{{dataArr.firstName}}</span>
      </li>
      <li>
        <i>{{$t('vr.name')}}</i>
        <span>{{dataArr.lastName}}</span>
      </li>
      <li>
        <i>{{$t('vr.phone')}}</i>
        <span>{{dataArr.phone}}</span>
      </li>
      <li>
        <i>{{$t('vr.email')}}</i>
        <span>{{dataArr.email}}</span>
      </li>
      <li>
        <i>{{$t('vr.company')}}</i>
        <span>{{dataArr.company}}</span>
      </li>
      <li>
        <i>{{$t('vr.country')}}</i>
        <span>{{dataArr.country}}</span>
      </li>
    </ul>
    <button class="btn" @click="logOut">{{$t('vr.logout')}}</button>
  </div>
</template>

<script>
import api from "servicePath/index";
import { mapState, mapMutations } from "vuex";
export default {
  data() {
    return {
      dataArr:[]
    };
  },
  computed: {
     ...mapState(['lang','userInfo'])
  },
  mounted() {
    this.getInformation();
  },
  methods: {
    ...mapMutations(['saveloginInfo']),
    async getInformation() {
      const res = await api.getInformation();
      this.dataArr = res.data;
      console.log(res);
    },
    logOut() {
      // 退出
      sessionStorage.removeItem('loginInfo');
      sessionStorage.removeItem('vrToken');
      this.saveloginInfo('');
       this.$message({
            message: this.lang=='en'?'Exit succeeded':this.lang=='de'?'Beenden erfolgreich':'退出成功',
            type: 'success'
        });
      let r = "/foundation/pc/index";
      if (this.$route.path.indexOf("/fakuma") >= 0) {
        r = "/fakuma/pc/home";
      }
      this.$router.push(r);
    }
  }
};
</script>

<style lang="scss" scoped>
h1 {
  margin-bottom: 30px;
}
.infoUl {
  width: 100%;
  li {
    width: 70%;
    background: #fff;
    border-radius: 6px;
    border: none;
    -moz-box-shadow: 1px 1px 14px 5px #f0f0f0;
    -webkit-box-shadow: 1px 1px 14px 5px #f0f0f0;
    box-shadow: 1px 1px 14px 5px #f0f0f0;
    padding: 18px 15px;
    margin-bottom: 15px;
    font-size: 14px;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    i {
      font-style: normal;
      color: #d2d5dc;
    }
    span {
      color: #444;
    }
  }
}
.btn {
  background: linear-gradient(to right, #ff7f41, #e6007e);
  width: 70%;
  padding: 15px;
  font-size: 14px;
  color: #fff;
  text-align: center;
  border: none;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
}
</style>